package com.warmlight.voicepacket.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.warmlight.voicepacket.R;
import com.warmlight.voicepacket.base.MBaseAdapter;
import com.warmlight.voicepacket.dbdata.DBFloatPlaylist;

import java.util.List;

/**
 * 未登录情况下的添加播单
 * Created by jason on 2018/6/4.
 */

public class Add2ListAdapter extends MBaseAdapter {

    public Add2ListAdapter(Context context, List<DBFloatPlaylist> list) {
        super(context, list);
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup viewGroup) {
        final ViewHolder holder;
        if (convertView != null) {
            holder = (ViewHolder) convertView.getTag();
        } else {
            convertView = View.inflate(mContext, R.layout.item_playlist_add, null);
            holder = new ViewHolder();
            holder.tv_add_title = (TextView) convertView.findViewById(R.id.tv_add_title);
            holder.tv_add_list_count = (TextView) convertView.findViewById(R.id.tv_add_list_count);
            convertView.setTag(holder);
        }

        DBFloatPlaylist data = (DBFloatPlaylist)mList.get(position);
        holder.tv_add_title.setText(data.getList_name());
        holder.tv_add_list_count.setText(data.getList_count());

        return convertView;
    }

    private class ViewHolder {
        TextView tv_add_title;
        TextView tv_add_list_count;
    }

}
